<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->index()->comment('名称');
            $table->string('type')->comment('表单类型 branch 打分,number 数量,text 文本,select 选择器,date 日期');
            $table->boolean('required')->default(false)->comment('是否必填项');
            $table->boolean('photo')->default(false)->comment('是否上传图片');
            $table->json('params')->nullable()->comment('参数');
            $table->timestamp('start_time')->nullable()->comment("任务生效时间");
            $table->timestamp('end_time')->nullable()->comment("任务失效时间");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tasks');
    }
}
